	import * as index from '@/api/index.js'
export default {
	data() {
		return {
			form:{
				username:'',
				tx:'',
				mobile:''
			},
			loading:false,
			userinfo:{},
			list:[
				{
					name:'我的昵称',
					image:'/static/index/nickname.png'
				},
				{
					name:'联系方式',
					image:'/static/index/mobile.png'
				},
				{
					name:'我要投诉',
					image:'/static/index/tousu.png',
					url:'/pages/user/feedback/index'
				},
				{
					name:'退出账号',
					image:'/static/index/logout.png'
				}
			],
			replyList:[
				{
					name:'全部投诉',
					image:'/static/index/all.png',
					url:'/pages/user/complaint/index?index=0'
				},
				{
					name:'未回复投诉',
					image:'/static/index/noreply.png',
					url:'/pages/user/complaint/index?index=1'
				},
				{
					name:'已回复投诉',
					image:'/static/index/reply.png',
					url:'/pages/user/complaint/index?index=2'
				}
			]
		}
	},
	computed: {
		assetUrl() {
			return this.$tools.baseURL;
		},
	},
	onShow() {
		this.getuserinfo()
	},
	onLoad() {
	},
	methods: {
		complaintBnt() {
			uni.navigateTo({
				url:'/pages/user/complaint/index'
			})
		},
		feedback() {
			uni.navigateTo({
				url:'/pages/user/feedback/index'
			})
		},
		// 我要投诉
		complaint() {
			uni.navigateTo({
				url:'/pages/user/feedback/index'
			})
		},
		// 头像回调
		chooseavatar(e){
			index.update({tx:e.detail.avatarUrl}).then(res=>{
				this.getuserinfo()
			})
		},
		jump(item,index){
			if(uni.getStorageSync('token')){
				if(item.name == '我的昵称'){
					this.$refs.username.open()
				}
				else if(item.name == '联系方式'){
					this.$refs.mobile.open()
				}
				else{
					this.$tools.navigate(item.url)
				}
			}
			else{
				this.$tools.navigate('/pages/login/index')
			}
		},
		getuserinfo(){
			index.getuserinfo({id:uni.getStorageSync('userinfo').userId}).then(res=>{
				this.userinfo = res.user
				this.loading = true
			})
		},
		dialogInputConfirm(e){
			console.log(e,'eee');
			index.update({username:e}).then(res=>{
				this.getuserinfo()
			})
		},
		dialogMobile(e){
			index.update({mobile:e}).then(res=>{
				this.getuserinfo()
			})
		}
	}
}